package com.hsd.app.dao.impl;

import java.util.Map;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.hsd.app.dao.IHealthReportDao;
import com.hsd.core.base.dao.impl.BaseDAO;
import com.hsd.core.utils.PageParam;
import com.hsd.core.utils.PageQuery;
import com.hsd.core.utils.PageUtil;

@Repository 
public class HealthReportDaoImpl extends BaseDAO implements IHealthReportDao{
	@Override
	public PageUtil loadMySurveyList(PageParam pageParam) {
		PageQuery pq = new PageQuery(pageParam);
		Query query = null;
		query = this.getSession().createQuery(pageParam.getSearchSql());
		Map map =pageParam.getConditionMap(); 
		int i = 0;
		if(map.containsKey("surveyName"))
		{     
			query.setString(i++, "%"+(String)map.get("surveyName")+"%");
		}  
		PageUtil pu = pq.getPageUtil(query,this.getSession());
		return pu;
	}
 
}
